import { pinia } from '@/store'
import { useAppStore } from '@/store/modules/app'
import { imageUrl } from '@/config/api'
const store = useAppStore(pinia)

export const usePageCycle = async () => {
  onLoad(async (e) => {
    console.log('------全局onLoad 触发::::::: ', e)
  })

  onShow(async () => {
    console.log('------全局oonShow 触发::::::: ')
  })
}

// 获取组件ui-page ref
export const uiPageRef = ref()

// 获取资源路径
export const getImageUrl = (e) => {
  return imageUrl + e
}

// 保存当前页面路径
export const useSavePath = () => {
  store.setRedirectLoginUrl(uni.$getCurRouter()?.fullPath)
  console.log(store.redirectLoginUrl, '----页面路径已保存')
}
